﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YuzKitabi.Class;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;


namespace YuzKitabi.Data
{
   public class HataVeritabani:BaglantiVeritabani
    {
       public HataVeritabani()
       {
           if (_baglanti == null)
               this._baglanti = new Baglanti();
       }

       protected void HataEkle(Hata hata)
       {
           try
           {
               _baglanti.SpAdi = "SpHataEkle";
               _baglanti.ParametreEkle("@KullaniciId", System.Data.SqlDbType.Char, hata.KullaniciId);
               _baglanti.ParametreEkle("@Tarih", System.Data.SqlDbType.DateTime, hata.Tarih);
               _baglanti.ParametreEkle("@Sinif", System.Data.SqlDbType.Char, hata.Sinif);
               _baglanti.ParametreEkle("@Method", System.Data.SqlDbType.Char, hata.Method);
               _baglanti.ParametreEkle("@HataMesaj", System.Data.SqlDbType.Char, hata.HataMesaj);


               int sonuc = _baglanti.SorguCalistir();
           }

           catch { }
       }

       protected DataTable HataListele()
       {
           try
           {
               using (Baglanti baglanti = new Baglanti())
               {
                   baglanti.SpAdi = "SpHataListele";
                   return baglanti.SorguCalistirTablo();
               }

           }

           catch
           {
               return null;
           }
       }


    }
}
